{% include "../public/min-header.html" %}

<script src="/public/tool/UEditor/ueditor.config.js" type="text/javascript"></script>
<script src="/public/tool/UEditor/ueditor.all.js" type="text/javascript"></script>

<div class="wrapper">
    {% include "../public/breadcrumb.html" %}
    <section class="content ">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="{{helper.pathFor('adalsmg')}}" data-toggle="tooltip" title="返回" class="btn btn-default"
                    data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> {{'添加' if act=='add' else '修改' }}文章</h3>
                </div>
                <div class="panel-body ">
                    <!--表单数据-->
                    <form method="post" id="submitForm" class="layui-form">
                        <!--通用信息-->
                        <div class="tab-content col-md-10">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                        <tr>
                                            <td class="col-sm-2">标题：</td>
                                            <td class="col-sm-10">
                                                <input type="text" class="form-control" name="title"
                                                    value="{{info.title}}">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-2">描述：</td>
                                            <td class="col-sm-10">
                                                <input type="text" class="form-control" name="desc"
                                                    value="{{info.desc}}">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-2">封面：</td>
                                            <td class="col-sm-10">
                                                <input id="file_upload" type="file" multiple="true" size="18"
                                                    class="form-control">
                                                <img {% if not info.thumb %} style="display: none"
                                                    {%endif%}id="upload_org_code_img" src="{{info.thumb}}" width="200"
                                                    height="100">
                                                <input id="file_upload_image" name="thumb" type="hidden" multiple="true"
                                                    value="{{info.thumb}}">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-2">类型</td>
                                            <td class="col-sm-10">
                                                <select name="type_id" class="form-control" >
                                                    {% for index,item in typeList %}
                                                    <option value="{{index}}" {{'selected' if info.type_id==index else ''}}>
                                                        {{item}}</option>
                                                    {% endfor %}
                                                </select>
                                            </td>
                                        </tr>
                                        <tr class="text">
                                            <td>内容：</td>
                                            <td style="height: 600px;">
                                                <textarea name="content" rows="6" class="tarea form-control"
                                                    id="post_content" style="width: 100%">{{info.content}}</textarea>
                                                <span id="err_attr_name" style="color:#F00; display:none;"></span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>状态:</td>
                                            <td id="order-status">
                                                <label class="radio-inline"><input name="status" type="radio" value="1" {{'checked' if info.status == 1 else ''}} >正常</label>
                                                <label class="radio-inline"><input name="status" type="radio" value="0"  {{'checked' if info.status == 0 else ''}} >关闭</label>
                                            </td>
                                        </tr>
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td>
                                                <input type="hidden" name="act" value="{{act}}">
                                                <input type="hidden" name="id" value="{{info.id}}">
                                            </td>
                                            <td class="text-left">
                                                <input class="btn btn-primary" type="button"
                                                    data-post-url="{{helper.pathFor('adalad')}}" id="submitBtn"
                                                    data-jump-url="{{helper.pathFor('adalin')}}" value="保存">
                                            </td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </form>
                    <!--表单数据-->
                </div>
            </div>
        </div>
    </section>
</div>
<style type="text/css">
    .tarea {
        padding: 0;
    }
</style>
<script>
    var editor;
    $(function () {
        //具体参数配置在  editor_config.js 中
        var options = {
            zIndex: 99,
            initialFrameWidth: "100%", //初化宽度
            initialFrameHeight: 400, //初化高度
            focus: false, //初始化时，是否让编辑器获得焦点true或false
            maximumWords: 5000, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
            pasteplain: true, autoHeightEnabled: true,
            autotypeset: {
                mergeEmptyline: true,        //合并空行
                removeClass: true,           //去掉冗余的class
                removeEmptyline: false,      //去掉空行
                textAlign: "left",           //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版
                imageBlockLine: 'center',    //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版
                pasteFilter: false,          //根据规则过滤没事粘贴进来的内容
                clearFontSize: false,        //去掉所有的内嵌字号，使用编辑器默认的字号
                clearFontFamily: false,      //去掉所有的内嵌字体，使用编辑器默认的字体
                removeEmptyNode: false,      //去掉空节点
                //可以去掉的标签
                removeTagNames: { "font": 1 },
                indent: false,               // 行首缩进
                indentValue: '0em'           //行首缩进的大小
            },
            toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'forecolor', '|', 'simpleupload']
            ],
            serverUrl: "/ueditor",
        };
        /* editor = new UE.ui.Editor(options);
        editor.render("post_content"); */
        var ue = UE.getEditor('post_content', options);
    });

</script>

{% include "../public/main-footer.html" %}